#include "base_malloclib.h"


/* 引入brkheap */
#include <metalc/mlos/brkheap.h>

// #ifdef __aarch64__
// 	#define TLSF_APDS	cacsffwd
// #else
// 	#define TLSF_APDS	sffwd
// #endif
#define TLSF_APDS	cacsffwd
/* 定义tlsf */
#include <metalc/mlayer/tlsf.h>
static tlsf_obj_t *ptlsf;
DEF_TLSF_MLAYER(tlsf, ptlsf, 4, MLAYER_SZ_MAXBIT, 4 * SIZE_1G, 5, page_alloc)

/* 组合 */
COMPOSE_MLAYER(malloc_tlsf, mallocapi, tlsf, brkheap)

/* 定义tls */
DEF_MTLS_PTHREAD(GET_MLAYER_OBJNR(malloc_tlsf), 4096, mlcc_palloc, mp_coreid)


/* mlcc和mtls一定要放在第一位初始化 */
DEF_SYSINIT(malloc_perm_pool, malloc_tlsf, mtls)
DEF_CFLOWFIN(mtls)
DEF_CFLOWINIT(mtls, malloc_tlsf)
DEF_SYSFIN(__omega)